import java.util.Collection;
import java.util.Vector;

/**
 * Holds the URL as a String and its adjacency list (as a vector or Strings)
 * Used in the traversal algorithms
 * 
 * @author Alrik Firl (afirl)
 * @author Pin-Wei Cheng (picheng)
 */
public class Vertex {
	String URLVertex;
	Vector<String> adjacentURL;

	/**
	 * Constructor initializes the base URL and instantiates its adjacency list
	 * 
	 * @param URLnm
	 */
	public Vertex(String URLnm) {
		URLVertex = URLnm;
		adjacentURL = new Vector<String>();
	}

	/**
	 * The compare method for Vertex compares the internal String values
	 * 
	 * @param comp
	 *            the string to compare
	 * @return specifies which Vertex is larger
	 */
	public boolean equals(Vertex comp) {
		if (this.URLVertex.equals(comp.URLVertex)) {
			return true;
		} else
			return false;
	}

	/**
	 * Setter method for the current URL's adjacency list; adds single the input
	 * String to the adjacency list
	 * 
	 * @param adj
	 *            the individual String specifying an adjacent URL
	 */
	public void AddAdjacent(String adj) {
		adjacentURL.add(adj);
	}

	/**
	 * Setter method for the current URL's adjacency list; adds the entire input
	 * collection to the adjacency list
	 * 
	 * @param adjall
	 *            a collection of Strings specifying adjacent URLs
	 */
	public void AddAdjacent(Collection<String> adjall) {
		adjacentURL.addAll(adjall);
	}

}
